using System.Collections;
using NUnit.Framework;

namespace PhoneBook.Core.Commands
{
    /// <summary>
    /// Exercise editing commands.
    /// </summary>
    /// 
    [TestFixture]
    public class EditFixture : BaseTest
    {
        public const string INSERT_ENTRY_KEY_VALUE = "12345678-1234-123456789-1234567890AB";
        public const string UPDATE_ENTRY_KEY_VALUE = "c5b6bbb1-66d6-49cb-9db6-743af6627828";
        public const string FIRST_NAME_VALUE = "William";
        public const string LAST_NAME_VALUE = "Clinton";
        public const string USER_NAME_VALUE = "bubba";
        public const string EXTENSION_VALUE = "5557437828";
        public const string HIRED_VALUE = "1992-08-19";
        public const string HOURS_VALUE = "37.5";
        public const string EDITOR_VALUE = "0";

        protected override void Populate(IDictionary context)
        {
            context[App.ENTRY_KEY] = UPDATE_ENTRY_KEY_VALUE;
            context[App.FIRST_NAME] = FIRST_NAME_VALUE;
            context[App.LAST_NAME] = LAST_NAME_VALUE;
            context[App.USER_NAME] = USER_NAME_VALUE;
            context[App.EXTENSION] = EXTENSION_VALUE;
            context[App.HIRED] = HIRED_VALUE;
            context[App.HOURS] = HOURS_VALUE;
            context[App.EDITOR] = EDITOR_VALUE;
        }

        [Test]
        public void InsertDelete()
        {
            AssertInsertDelete(App.ENTRY_SAVE, App.ENTRY_KEY, INSERT_ENTRY_KEY_VALUE, App.ENTRY_DELETE);
        }

        private string[] ENTRY_KEYS = {App.ENTRY_KEY, App.FIRST_NAME, App.LAST_NAME, App.USER_NAME, App.EXTENSION, App.HIRED, App.HOURS, App.EDITOR};

        [Test]
        public void Edit()
        {
            AssertEdit(App.ENTRY, App.ENTRY_KEY, UPDATE_ENTRY_KEY_VALUE, ENTRY_KEYS);
        }

        [Test]
        public void Update()
        {
            AssertUpdate(App.ENTRY_SAVE, App.ENTRY_KEY, UPDATE_ENTRY_KEY_VALUE);
        }


    }
}